package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.service.ViewService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/view")
@Api(value = "景点相关的业务",description = "景点")
public class FontViewController {
    @Autowired
    ViewService viewService;

    //无条件查询所有的景点
    @GetMapping("/viewfindAll")
    public ResultMsg findAll(@RequestParam(required = false,defaultValue = "1") int current,@RequestParam(required = false,defaultValue = "5") int size){
        return viewService.findAll(current,size);
    }
    //按照城市查询该城市的所有景点
    @GetMapping("/viewfindAllCityId")
    public  ResultMsg findAllCity(int cityId){
        return viewService.findAllCity(cityId);
    }
    //按照城市名查询该城市的所有景点
    @GetMapping("/viewfindAllCityName")
    public ResultMsg findAllCityName(String cityName){
        return viewService.findAllCityName(cityName);
    }
    //按照价格降价排序某城市的所有景点
    @GetMapping("/viewDesc")
    public ResultMsg findDesc(){
        return viewService.findDesc();
    }

    //按照价格升价排序某城市的所有景点
    @GetMapping("/viewAsc")
    public ResultMsg viewAsc(){
        return viewService.viewAsc();
    }

    //查询某城市所有的景点名称
    @GetMapping("/viewName")
    public ResultMsg findName(String cityName){
        return viewService.findName(cityName);
    }
    //根据景点名查询所有的景点
    @GetMapping("/viewCityNameAndVname")
    public ResultMsg viewCityNameAndVname(String cname,String vname){
        return viewService.viewCityNameAndVname(cname,vname);
    }
    //根据景点的Id查一个景点
    @GetMapping("/viewId")
    public ResultMsg viewFindId(Integer viewId){
        return viewService.viewFindId(viewId);
    }
}
